{include file="common/_meta" /}
<title>订单管理</title>
</head>
<body>
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 订单<span class="c-gray en">&gt;</span> 订单管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
		<div class="pd-20 text-c">
			<div class="text-c">
				<form action="" method="post">
					<input type="hidden" name="type" id="type" value="so" />
					日期范围：
					<input type="datetime-local" value="{$start|default=''}"  name="start" id="logmin" class="input-text Wdate" style="width:120px;">
					——
					<input type="datetime-local" value="{$end|default=''}"  name="end" id="logmax" class="input-text Wdate" style="width:120px;">
					<input type="text" name="key" value="{$key}" id="" placeholder="订单号/用户名/手机号" style="width:250px" class="input-text">
					<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
				</form>
			</div>
			<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">

				
			</span> <span class="r">共有数据：<strong>{$count1}</strong> 条</span> </div>
			<div class="mt-20">
				<table class="table table-border table-bordered table-hover table-bg table-sort">
					<thead>
						<tr class="text-c">
							<th width="20">ID</th>
							<th width="80">订单号</th>
							<th width="100">产品名称</th>
							<th width="40">商品单价</th>
							<th width="40">数量</th>
							<th width="60">付款价格</th>
							<th width="60">支付状态</th>
							
							<th width="60">支付方式</th>
							<th width="100">客户留言</th>
							<th width="80">收货人</th>
							<th width="80">收货电话</th>
							<th width="100">下单用户</th>
							<th width="80">备注</th>
							<th width="80">支付时间</th>
							<th width="60">订单状态</th>
							<th width="60">是否查看</th>

							<th width="60">订单退还</th>
							<th width="50">操作</th>
						</tr>
					</thead>
					<tbody>
						{volist name='order' id='user'}
						<tr class="text-c">
							<td>{$user.id}</td>
							<td>{$user.out_trade_no}</td>
						
							<td>{$user.goods_name|default='尚未填写'}</td>
							<td>{$user.goods_price}</td>
							<td>{$user.order_num}</td>
							<td>{$user.goods_price_zong}</td>
							<td>{$user.pay_status ? '已经支付' : '未支付'}</td>
							

							<td>
								{switch name="user.payment"}
								    {case value="1"}支付宝{/case}
								    {case value="2"}微信{/case}
									 {case value="4"}积分兑换{/case}
								    {default /}信息错误
								{/switch}
							</td>
							<td>{$user.desc|default='尚未填写'}</td>
							<td>{$user.name ?? '无收货人'}</td>
							<td>{$user.mphone ?? $user.phone |default='尚未填写'}</td>
							<td>{$user.username ? $user.username : $user.mphone}</td>
	
							<td>{$user.beizhu|default='尚未填写'}</td>
							<td>
							{if $user.order_time}
							{$user.order_time|date='Y-m-d H:i:s'}
							{else /}
							没有支付
							{/if}
							</td>
							<td>
								{switch name="user.order_type"}
								    {case value="0"}<button type="button" class="btn btn-warning radius">未发货</button>{/case}
								    {case value="1"}<button type="button" class="btn btn-primary radius">已经发货</button>{/case}
									{case value="2"}<button type="button" class="btn btn-success radius">已经收货</button>{/case}
									{case value="3"}<button type="button" class="btn btn-danger radius">退换货单</button>{/case}
									{case value="4"}<button type="button" class="btn btn-default radius">前台已经删除</button>{/case}	
								{/switch}
							</td>
							<td>
								{switch name="user.order_status"}
								    {case value="0"}<button type="button" class="btn btn-danger radius">未查看</button>{/case}
								    {case value="1"}<button type="button" class="btn btn-primary radius">已查看</button>{/case}
								    {default /}信息错误
								{/switch}
							</td>
							

							
							
							<td>
								{switch name="user.is_tui"}
								    {case value="0"}<button type="button"  onclick="system_category_tui(this,{$user.id})" class="btn btn-default radius">未退还</button>{/case}
								    {case value="1"}<button type="button" class="btn btn-danger radius">已退还</button>{/case}
								    {default /}信息错误
								{/switch}
							</td>
							
							<td class="f-14">
							
								<a class="ml-5" title="编辑" href="javascript:;" onclick="system_category_edit('订单编辑','{:url(\'order/edit\',[\'id\'=>$user.id])}')" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
								<a title="删除" href="javascript:;" onclick="system_category_del(this,{$user.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
							</td>
						</tr>
						{/volist}
					</tbody>
				</table>
				
			</div>
			{$order|raw}
		</div>
<!--_footer 作为公共模版分离出去-->
{include file="common/_footer" /}
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript">
//$('.table-sort').dataTable({
//	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
//	"bStateSave": true,//状态保存
//	"aoColumnDefs": [
//	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
//	  {"orderable":false,"aTargets":[0,4]}// 制定列不参与排序
//	]
//});
/*系统-订单-添加*/
function system_category_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*系统-订单-编辑*/
function system_category_edit(title,url,w,h){
	layer_show(title,url,w,h);
}
/*系统-订单-删除*/
function system_category_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.post(
			"{:url('order/ajax')}",
		{
			id:id,
			type:'order_del',
		},
		function(result){
	        if(result===0){
	        	layer.msg('删除失败!',{icon: 5,time:1000});
	        }else if(result===1){
	        	$(obj).parents("tr").remove();
				layer.msg('已删除!',{icon:1,time:1000});
	        }
	    });	

	});
}
function system_category_tui(obj,id){
	layer.confirm('确认要退还alg吗？',function(index){
		$.post(
			"{:url('order/ajax')}",
		{
			id:id,
			type:'order_tui',
		},
		function(result){
	        if(result.code===0){
	        	layer.msg(result.message,{icon: 5,time:1000});
	        }else if(result.code===1){
				location.reload();
				layer.msg('退还成功!',{icon:1,time:1000});
	        }
	    });	

	});
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>